\section{ChemotaxisUtil::GammaSampler Class Reference}
\label{classChemotaxisUtil_1_1GammaSampler}\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
{\tt \#include $<$util.hh$>$}



\subsection{Detailed Description}
Generates random numbers sampled from a gamma distribution.

A nice implementation of an algorithm that samples from a gamma distributionwith code modified from the book :

Press, Teukolsky, Vetterling, and Flannery. \char`\"{}Numerical Recipes, The art of Scientific Computing\char`\"{}, Third Edition. 2007 Cambridge University Press.

It additionally has a parameter that allows the entire distribution to be shifted by a given amount and a generate function that resamples until the chosen number is within a particular range. In the chemotaxis \doxyref{model}{p.}{structmodel}, this code is used primarily to choose a new random angle from the distribution of changes in direction (fig 3 from Berg \& Brown, Chemotaxis in Escherichia coli analysed by Three-dimensional Tracking, Nature, volume 239, (1972) ) \subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf GammaSampler} (double {\bf alpha}, double {\bf beta})
\item 
{\bf GammaSampler} (double {\bf alpha}, double {\bf beta}, double {\bf meanShift})
\item 
double {\bf gen} ()
\item 
double {\bf gen} (double minAcceptableValue, double maxAcceptableValue)
\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
double {\bf alpha}
\item 
double {\bf oalpha}
\item 
double {\bf beta}
\item 
double {\bf a1}
\item 
double {\bf a2}
\item 
double {\bf meanShift}
\end{CompactItemize}


\subsection{Constructor \& Destructor Documentation}
\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!GammaSampler@{GammaSampler}}
\index{GammaSampler@{GammaSampler}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}GammaSampler::GammaSampler (double {\em alpha}, double {\em beta})}\label{classChemotaxisUtil_1_1GammaSampler_ec45f72997a11c18b48c230b43a12391}


Constructor to generate a basic gamma distribution. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em alpha}]the alpha parameter (note, alpha=k=shape). \item[{\em beta}]the beta parameter (note, beta=1/theta=1/scale). \end{description}
\end{Desc}
\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!GammaSampler@{GammaSampler}}
\index{GammaSampler@{GammaSampler}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}GammaSampler::GammaSampler (double {\em alpha}, double {\em beta}, double {\em meanShift})}\label{classChemotaxisUtil_1_1GammaSampler_68202ac9ef6b31da58c45229c21b9dcc}


Constructor to generate a gamma distribution that is shifted by the given amount. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em alpha}]the alpha parameter (note, alpha=k=shape). \item[{\em beta}]the beta parameter (note, beta=1/theta=1/scale). \item[{\em meanShift}]shifts the entire distribution by this amount. \end{description}
\end{Desc}


\subsection{Member Function Documentation}
\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!gen@{gen}}
\index{gen@{gen}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double GammaSampler::gen ()}\label{classChemotaxisUtil_1_1GammaSampler_f159e0800480c9c8aee7aec768e6b5e9}


Generates a new random number (using the \doxyref{NFutil}{p.}{namespaceNFutil} Mersenne Twister random number generator) sampled from the initialized gamma distribution. \index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!gen@{gen}}
\index{gen@{gen}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double GammaSampler::gen (double {\em minAcceptableValue}, double {\em maxAcceptableValue})}\label{classChemotaxisUtil_1_1GammaSampler_88a8c0bce1c79959b8a86dff8578759c}


Generates a new random number (using the \doxyref{NFutil}{p.}{namespaceNFutil} Mersenne Twister random number generator) sampled from the initialized gamma distribution that lies within (inclusive) of the range given. Carefull here! Your range should be such that it doesn't take forever to find a number in the range! \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em minAcceptableValue}]the minimum random value this function will return. \item[{\em maxAcceptableValue}]the maximum random value this function will return. \end{description}
\end{Desc}


\subsection{Member Data Documentation}
\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!alpha@{alpha}}
\index{alpha@{alpha}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double {\bf ChemotaxisUtil::GammaSampler::alpha}\hspace{0.3cm}{\tt  [protected]}}\label{classChemotaxisUtil_1_1GammaSampler_e56c24c3966a85e246f1538a71e6c08f}


\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!oalpha@{oalpha}}
\index{oalpha@{oalpha}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double {\bf ChemotaxisUtil::GammaSampler::oalpha}\hspace{0.3cm}{\tt  [protected]}}\label{classChemotaxisUtil_1_1GammaSampler_58213e76cda353c557b490c579205e53}


\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!beta@{beta}}
\index{beta@{beta}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double {\bf ChemotaxisUtil::GammaSampler::beta}\hspace{0.3cm}{\tt  [protected]}}\label{classChemotaxisUtil_1_1GammaSampler_31adf1f507813cb4360beedac52306e5}


\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!a1@{a1}}
\index{a1@{a1}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double {\bf ChemotaxisUtil::GammaSampler::a1}\hspace{0.3cm}{\tt  [protected]}}\label{classChemotaxisUtil_1_1GammaSampler_a9db3f05ebe349c70b0fe05a457253cf}


\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!a2@{a2}}
\index{a2@{a2}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double {\bf ChemotaxisUtil::GammaSampler::a2}\hspace{0.3cm}{\tt  [protected]}}\label{classChemotaxisUtil_1_1GammaSampler_246df20fb41dacdcd4e75fe9b583f99b}


\index{ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}!meanShift@{meanShift}}
\index{meanShift@{meanShift}!ChemotaxisUtil::GammaSampler@{ChemotaxisUtil::GammaSampler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double {\bf ChemotaxisUtil::GammaSampler::meanShift}\hspace{0.3cm}{\tt  [protected]}}\label{classChemotaxisUtil_1_1GammaSampler_f37724b0382df99d2e360042d2d2266c}




The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
/home/msneddon/eclipse/galileoSR1\_\-cpp/workspace/NFsim/src/NFtest/agentcell/cell/{\bf util.hh}\item 
/home/msneddon/eclipse/galileoSR1\_\-cpp/workspace/NFsim/src/NFtest/agentcell/cell/{\bf util.cpp}\end{CompactItemize}
